<ul>
    <?php
    $url = St_Registry::getConfig("base_url");
    $url = $url;
    
    $action = St_Registry::getActionName();
//    $action = $action == 'index' ? '' : $action;
    $controller = St_Registry::getControllerName();
    
    $menus = include APPLICATION_PATH . '/configs/menu.php';
    $user = St_Registry::getCurrentUser();
    if ($user['groupID'] == 3) {
        $menus = $menus['Sponsor'];
    } elseif($user['groupID'] == 2) {
        $menus = $menus['Advertiser'];
    }else{
        $menus = $menus['Guest'];
    }
    foreach ($menus as $key1 => $menu) {
        $sub_html = "";
        $current = "";
        if ($action == @$menu['action'] && $controller == $menu['controller']) {
            $current = 'class="current"';
        }
        if (is_array(@$menu['pages']) && count(@$menu['pages'])) {
            $sub_html = "<ul>";
            foreach ($menu['pages'] as $submenu) {
                $sub_html1 = "";
                $dir = "";
                $sub_current = "";
                if ($action == $submenu['action'] && $controller == $submenu['controller']) {
                    $sub_current = 'current';
                    $current = 'class="current"';
                }
                if (is_array(@$submenu['pages']) && count(@$submenu['pages'])) {
                    $sub_html1 = "<ul class='navigation-3'>";
                    foreach ($submenu['pages'] as $submenu1) {
                        $sub_current1 = "";
                        if ($action == $submenu1['action'] && $controller == $submenu1['controller']) {
                            $sub_current1 = 'class="current"';
                            $sub_current = 'current';
                            $current = 'class="current"';
                        }
                        $sub_html1 .= "
                            <li $sub_current1>
                                <a href=\"{$url}{$submenu1['controller']}/{$submenu1['action']}\">
                                {$submenu1['label']}
                                </a>
                            </li>
                        ";
                    }
                    $sub_html1 .= "</ul>";
                    $dir = 'dir';
                }
                $sub_html .= "
                    <li class='$sub_current $dir' >
                        <a href=\"{$url}{$submenu['controller']}/{$submenu['action']}\">
                        {$submenu['label']}
                        </a>
                        $sub_html1
                    </li>";
            }
            $sub_html .= "</ul>";
        }
        echo "
            <li $current>
                <a href=\"{$url}{$menu['controller']}/" . @$menu['action'] . "\">
                <span>{$menu['label']}</span>
                </a>
                $sub_html
            </li>";
    }
    ?>
</ul>